import accessInter from "@/api/access";
import de from "element-ui/src/locale/lang/de";

const actions = {
  // 行业资讯——菜单
  getJrxhMenu({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getJrxhMenu(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  // 行业资讯——列表
  getJrxhList({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getJrxhList(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  // 行业资讯——详情
  getJrxhDes({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getJrxhDes(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },    // 企业资质——申报表填报
  commitmentApplicationFrontSave({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .commitmentApplicationFrontSave(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },

  getpageAwardList({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getpageAwardList(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  getAwardMenuInfo({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getAwardMenuInfo(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  setADDesigner({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .setADDesigner(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //企业-申请须知和指南
  getCationsInfo({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getCationsInfo(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //企业-申请须知和指南附件下载
  getCationsEnc({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getCationsEnc(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //个人技能资质
  getPersigner({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getPersigner(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //个人技能资质详情
  getPersignerInfo({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getPersignerInfo(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //视频专区
  getVideo({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getVideo(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //视频专区详情
  getVideoInfo({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getVideoInfo(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //协会文件
  getApplyLette({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getApplyLette(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
  //协会文件 提交
  getApplyLetteSave({commit}, data) {
    return new Promise((resolve, reject) => {
      accessInter
        .getApplyLetteSave(data)
        .then((response) => {
          const {data} = response;
          if (!data) {
            reject("Verification failed, please Login again.");
          }
          resolve(data);
        })
        .catch((error) => {
          reject(error);
        });
    });
  },
};

export default {
  namespaced: true,
  actions,
};
